Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 6264: Destroyed Infantry no longer have negative weight #6263

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

psikomonkie
Copy link
Collaborator

@psikomonkie psikomonkie commented Dec 14, 2024

Fixes #6264

infantry.getInternal returns negative values for increasingly destroyed states for the infantry. But for determining weight it should just be 0 tons.

@psikomonkie psikomonkie marked this pull request as ready for review December 14, 2024 01:01
@psikomonkie psikomonkie changed the title Issue 5336: Destroyed Infantry no longer have negative weight Issue 6264: Destroyed Infantry no longer have negative weight Dec 14, 2024
@@ -384,6 +384,9 @@ public static double getWeightExact(Infantry infantry, CalculationReport report)

InfantryMount mount = infantry.getMount();
int activeTroopers = infantry.getInternal(Infantry.LOC_INFANTRY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like making this
int activeTroopers = Math.max(0, infantry.getInternal(Infantry.LOC_INFANTRY));
would do it more concisely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mechanized Tracked Platoon (Flamer) pays you for monthly spare parts and fuel instead of charging you
3 participants